/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.sigepa.recocidosimulado.Modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author carloslengua
 */
@Entity
@Table(name = "tipo_escala")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoEscala.findAll", query = "SELECT t FROM TipoEscala t"),
    @NamedQuery(name = "TipoEscala.findByIdtipo", query = "SELECT t FROM TipoEscala t WHERE t.idtipo = :idtipo"),
    @NamedQuery(name = "TipoEscala.findByDescripcion", query = "SELECT t FROM TipoEscala t WHERE t.descripcion = :descripcion")})
public class TipoEscala implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtipo")
    private Integer idtipo;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoEscala", fetch = FetchType.LAZY)
    private List<ItinerarioSim> itinerarioSimList;

    public TipoEscala() {
    }

    public TipoEscala(Integer idtipo) {
        this.idtipo = idtipo;
    }

    public TipoEscala(Integer idtipo, String descripcion) {
        this.idtipo = idtipo;
        this.descripcion = descripcion;
    }

    public Integer getIdtipo() {
        return idtipo;
    }

    public void setIdtipo(Integer idtipo) {
        this.idtipo = idtipo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<ItinerarioSim> getItinerarioSimList() {
        return itinerarioSimList;
    }

    public void setItinerarioSimList(List<ItinerarioSim> itinerarioSimList) {
        this.itinerarioSimList = itinerarioSimList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipo != null ? idtipo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoEscala)) {
            return false;
        }
        TipoEscala other = (TipoEscala) object;
        if ((this.idtipo == null && other.idtipo != null) || (this.idtipo != null && !this.idtipo.equals(other.idtipo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.pucp.sigepa.recocidosimulado.Modelo.TipoEscala[ idtipo=" + idtipo + " ]";
    }
    
}
